﻿using System;
using Wintellect.PowerCollections;
using System.Collections;

namespace PriorityQueue
{
    class PriorityQueue<T> : IEnumerable
    {
        OrderedBag<T> queue;

        public PriorityQueue()
        {
            this.queue = new OrderedBag<T>();
        }

        public T this[int index]
        {
            get
            {
                if (index >= 0 && index < this.queue.Count)
                {
                    return this.queue[index];
                }

                throw new IndexOutOfRangeException("Out of range");
            }
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return this.queue.GetEnumerator();
        }

        public void Add(T item)
        {
            this.queue.Add(item);
        }

    }
}
